// 创建一个路由器，并暴露出去

//引入路由器
import { createRouter, createWebHistory } from 'vue-router'

//引入要呈现的组件
import Home from "@/pages/Home.vue";
import About from "@/pages/About.vue";
import News from "@/pages/News.vue";
import Detail from "@/pages/Detail.vue";

//创建一个路由器
const router = createRouter({
    history: createWebHistory(),  //路由器的工作模式
    routes: [
        {
            path: '/Home',
            component: Home
        },
        {
            path: '/About',
            component: About
        },
        {
            name: 'xiao',
            path: '/News',
            component: News,
            children: [
                {
                    path: 'Detail/:id/:title/:content', // 使用相对路径
                    component: Detail
                }
            ]
        },
    ]
})

//暴露出去router
export default router
